import java.util.Random;
public class random {
	private static Random r = new Random();
	/**
	 * Generate list of the numbers from 1 to num, randomly shuffled
	 * @param num The maximum number in the generated list
	 * @return The list
	 */
	public static nodeList<Integer> createRadomIntList(int num){
		nodeList<Integer> rnd = new nodeList<Integer>();
		for (int i=1;i<=num;i++){
			int j=r.nextInt(i);
			rnd.insertInfoInIndex(i,j);
		}
		return rnd;
	}
	/**
	 * Same as createRadomIntList, but implemented recursively
	 * @param num The maximum number in the generated list
	 * @return A new generated list, with the numbers 1 to num randomly shuffled
	 */
	public static nodeList<Integer> recRndIntLst(int num){
		if (num==1){
			return new nodeList<Integer>(1);
		}
		nodeList<Integer> rnd;
		rnd = recRndIntLst(num-1);
		addPlusOne(rnd);
		return rnd;
	}
	private static void addPlusOne(nodeList<Integer> rnd){
		int i = rnd.length()+1;
		int j = r.nextInt(i);
		rnd.insertInfoInIndex(i+1, j);
	}
}
